package com.qianfeng.smartplatform.service.impl;/*
 *@Description:
 *@author:赵健
 *@Date:zjzzz 2022/9/7 16:49
 */

import com.qianfeng.smartplatform.mapper.OnLineUserMapper;
import com.qianfeng.smartplatform.pojo.SysUserOnline;
import com.qianfeng.smartplatform.service.OnLineUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
@Service
@Transactional
public class OnLineUserServiceImpl implements OnLineUserService {
    @Autowired
    private OnLineUserMapper onLineUserMapper;

    @Override
    public void addOnlineData(SysUserOnline sysUserOnline) {
        String loginName = onLineUserMapper.dataExist(sysUserOnline.getLoginName());
        if (StringUtils.hasText(loginName)) {
            //已经存在了
            onLineUserMapper.updateOnlineData(sysUserOnline);
        }else{
            onLineUserMapper.addOnlineData(sysUserOnline);
        }
    }
}
